using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAnimatorTrigger : MonoBehaviour
{
    private Player player => GetComponentInParent<Player>();
    private Inventory inventory => Inventory.Instance;
    private void AnimatorTrigger()
    {
        player.AnimatorIsTrigger();
    }
    private void AttackTrigger()
    {
        AudioManager.Instance.PlayClip(0,null);
        Collider2D[] collider2DArray = Physics2D.OverlapCircleAll(player.attackCheck.position, player.attackRadius);
        foreach (var collider in collider2DArray)
        {
            if (collider.GetComponent<Enemy>() != null)
            {
                EnemyStat enemystate = collider.GetComponent<EnemyStat>();
                if (enemystate != null)
                {
                    player.stat.DoDamage(enemystate);
                    player.playerFx.ScreenShake(player.playerFx.swordBackshakePower);
                }
                inventory.CanUseEquipment(EquipmentitemType.Weapon,ref inventory.weaponlastUseTime, collider.transform);
            }
        }
    }
    private void SwordSkillTrigger()
    {
        SkillManager.Instance.swordSkill.CreateSword();
    }
    
}
